import type {CinemaSeat, MovieCinemaType, SeatLocation} from "@/interfaces/movie-cinema";

export const getUrl = (url:string):string =>{
    return new URL(`../static/${url}`, import.meta.url).href
}

export const createCinemaSeats = (row:number,column:number,selectedList:SeatLocation[]=[]):CinemaSeat[][] =>{
    let cinemaSeats:CinemaSeat[][] = []
    const seat:CinemaSeat = {
        status: 0,
        icon: 'seat',
        customStyle: {
            backgroundColor: "#9AC1F0"
        }
    }
    for (let i:number = 0; i < row; i++) {
        let rowSeat:CinemaSeat[] = []
        for (let j:number = 0; j < column; j++) {
            rowSeat.push(seat)
        }
        cinemaSeats.push(rowSeat)
    }
    selectedList.forEach((value:SeatLocation):void=>{
        cinemaSeats[value.row][value.column] = {
            status: 2,
            icon: 'seat-fill',
            customStyle: {
                backgroundColor: "#E45F2B"
            }
        }

    })
    return cinemaSeats
}
